#include "MinionStat.h"
#include "CNetworkIO.h"

void MinionStat::displayStats()
{
  std::cout << "Minion Statistics: " << endl;
  stringc tempo = name;

  std::cout << "Name: " << tempo.c_str() << endl;
  tempo = typeName;
  std::cout << "Type: " << tempo.c_str() << endl;
  std::cout << "HP  : " << hp << endl;
  std::cout << "MAX : " << maxHp << endl;
  std::cout << "MP  : " << mp << endl;
  std::cout << "MAX : " << maxMp << endl;

  std::cout << "ATK : " << atk << endl;
  std::cout << "MATK: " << mAtk << endl;
  std::cout << "DEF : " << def << endl;
  std::cout << "MDEF: " << mDef << endl;
  std::cout << "SPD : " << speed << endl;
  std::cout << "LVL : " << (int)level << endl;

  std::cout << "RNG : " << range << endl;
  std::cout << "MOVE: " << movement << endl;
}

void MinionStat::netWrite(BitStream &bs)
{
  CNetworkIO::writeWcs(bs, name.c_str());
  CNetworkIO::writeWcs(bs, typeName.c_str());

  bs.Write(hp);
  bs.Write(maxHp);
  bs.Write(mp);
  bs.Write(maxMp);

  bs.Write(atk);
  bs.Write(mAtk);
  bs.Write(def);
  bs.Write(mDef);
  bs.Write(speed);
  bs.Write(level);

  bs.Write(range);
  bs.Write(movement);
}

void MinionStat::netRead(BitStream &bs)
{
  name = CNetworkIO::readWcs(bs);
  typeName = CNetworkIO::readWcs(bs);

  bs.Read(hp);
  bs.Read(maxHp);
  bs.Read(mp);
  bs.Read(maxMp);

  bs.Read(atk);    // Attack point
  bs.Read(mAtk);   // Magic attack
  bs.Read(def);    // Defend
  bs.Read(mDef);   // Magic Defend
  bs.Read(speed);  // Speed point (Delay)
  bs.Read(level);

  bs.Read(range);
  bs.Read(movement);
}
